package _0_语法._3_分支;

import java.util.Scanner;

public class _10_按位输出数字 {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int num;
        System.out.println("请输入一个不多于5位的正整数：");
        num = scanner.nextInt();

        if(num / 10000 > 0){
            System.out.println("5位数");
            System.out.println("万：" + num / 10000);
            System.out.println("千：" + num / 1000 % 10);
            System.out.println("百：" + num / 100 % 10);
            System.out.println("十：" + num / 10 % 10);
            System.out.println("个：" + num % 10);
        } else if (num / 1000 > 0) {
            System.out.println("4位数");
            System.out.println("千：" + num / 1000 % 10);
            System.out.println("百：" + num / 100 % 10);
            System.out.println("十：" + num / 10 % 10);
            System.out.println("个：" + num % 10);
        } else if (num / 100 > 0) {
            System.out.println("3位数");
            System.out.println("百：" + num / 100 % 10);
            System.out.println("十：" + num / 10 % 10);
            System.out.println("个：" + num % 10);
        } else if (num / 10 > 0) {
            System.out.println("2位数");
            System.out.println("十：" + num / 10 % 10);
            System.out.println("个：" + num % 10);
        } else {
            System.out.println("1位数");
            System.out.println("个：" + num % 10);
        }
    }
}
